package graphics.effects;
import org.lwjgl.opengl.GL11;

import graphics.system.Color;
import graphics.system.GLTools;
import graphics.system.Texture;
import graphics.system.TextureContainer;
import tools.Point;
public class GEFlashLight extends GEffect {
	private float radius;
	private Texture tex;
	public GEFlashLight(Point pos, float radius, Color c) {
		super(pos, radius, 100, true);
		this.color = c;
		this.radius = radius;
		node.boundingrad = radius;
		tex = TextureContainer.getTexture("lightmap");
	}
	public float getRadius() {
		return radius;
	}
	public void drawGlow() {
		float p = getProgress();
		float r = radius * (1 - p);
		node.boundingrad = r;
		GL11.glPushMatrix();
		node.setUpGl();
		GLTools.drawTexRect(Point.ZERO, r * 2, r * 2, 0, tex.getTexID(), color.withAlpha((1 - p)));
		GL11.glPopMatrix();
	}
}
